﻿@{
    Layout = "~/Views/Layout.cshtml";
}

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@using Microsoft.AspNetCore.Http
@model Wirehome.Cloud.Controllers.LoginModel

<style type="text/css">
    body {
        background-color: #DADADA;
    }

    body > .grid {
        height: 100%;
    }

    .column {
        max-width: 450px;
    }
</style>

<div class="ui middle aligned center aligned grid">
    <div class="column">

        @if (!User.Identity.IsAuthenticated)
        {
            <form class="ui large form" action="/Cloud/Account/Login?returnUrl=@Model.ReturnUrl" method="post">
                <div class="ui segment">
                    
                    <div>
                        <img src="~/images/Banner.png" class="image" style="width: 256px;">
                    </div>
                    
                    <div class="ui divider"></div>

                    <div class="field">
                        <div class="ui left icon input">
                            <i class="user icon"></i>
                            <input type="text" asp-for="IdentityUid" placeholder="E-mail address">
                        </div>
                    </div>
                    <div class="field">
                        <div class="ui left icon input">
                            <i class="lock icon"></i>
                            <input type="password" asp-for="Password" placeholder="Password">
                        </div>
                    </div>
                    <button type="submit" class="ui fluid large teal button">Log in</button>

                    @Html.ValidationSummary(false, null, new {@class = "lulu"})
                </div>

            </form>
        }
        else
        {
            <form class="ui large form" action="/Cloud/Account/Logout" method="post">
                <div class="ui segment">
                    <div class="field">
                        <div class="ui left icon input">
                            <span>
                                <i class="user icon"></i>
                                <span class="text">@User.Identity.Name</span>
                            </span>
                        </div>
                    </div>

                    <button type="submit" class="ui fluid large orange button">Log out</button>

                    <h2 class="ui header dividing">Links</h2>
                    <div class="ui vertical buttons fluid">
                        <a class="ui large button" href="/app/" target="_blank">Wirehome.App</a>
                        <a class="ui large button" href="/configurator/" target="_blank">Wirehome.Configurator</a>
                        <a class="ui large button" href="/api/" target="_blank">Wirehome.API definition</a>
                    </div>
                </div>

            </form>
        }

    </div>
</div>